#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    vector<int> grayCode(int n) {
        int len = 1 << n;
        vector<int>ret(len);
        for (int i = 0; i < len; i++)
        {
            ret[i] = (i >> 1) ^ i;
        }
        return ret;
    }
};
